<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">

<head th:include="include :: header"></head>
<link th:href="@{/css/notice/wangeditor.css}" rel="stylesheet"/>


<body>

<div class="operator">
    <button id="save" class="btn btn-success btn-xs">保存</button>
    <button id="clear" class="btn btn-success btn-xs">清空</button>
</div>
<div id="div_toolbar" class="toolbar">

</div>

<div id="div_text" class="text">
    <p>请在此处输入内容</p>
</div>


<!-- 注意， 只需要引用 JS，无需引用任何 CSS ！！！-->
<script type="text/javascript" src="https://unpkg.com/wangeditor@3.1.1/release/wangEditor.min.js"></script>
<div th:include="include::footer"></div>
<script type="text/javascript" th:inline="javascript">
    var E = window.wangEditor
    var editor = new E('.toolbar', '.text')
    // editor.customConfig.uploadImgServer = '/upload'
    // base64保存图片
    editor.customConfig.uploadImgShowBase64 = true;
    // 或者 var editor = new E( document.getElementById('editor') )
    editor.create();

    // 渲染内容
    var content = [[${item.content}]];
    editor.txt.html(content)

    $("#save").click(function () {
        var content = editor.txt.html()
        var prefix = ctx + "system/zhGuide";
        $.operate.save(prefix + "/edit", {
            "id": GetQueryParam("id"),
            "content": content
        });
    });
    $("#clear").click(function () {
        editor.txt.clear()
    });


</script>
</body>
</html>